﻿namespace PugLib.UnitTest
{
    using System;
    using System.Reflection;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class DelegateFactoryTest
    {
        [TestMethod]
        public void CreateTest()
        {
            MethodInfo method = typeof(String).GetMethod("StartsWith", new[] { typeof(string) });
            Func<object, object[], object> callback = DelegateFactory.Create(method);

            const string foo = "this is a test";
            bool result = (bool)callback(foo, new[] { "this" });

            Assert.IsTrue(result);
        }
    }
}